/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package job.manager.db.ec;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Administrator
 */
@Entity
@Table(name = "Job")
@NamedQueries({@NamedQuery(name = "JobEB.findAll", query = "SELECT j FROM JobEB j"), @NamedQuery(name = "JobEB.findById", query = "SELECT j FROM JobEB j WHERE j.id = :id"), @NamedQuery(name = "JobEB.findByNumberOfPeople", query = "SELECT j FROM JobEB j WHERE j.numberOfPeople = :numberOfPeople"), @NamedQuery(name = "JobEB.findByName", query = "SELECT j FROM JobEB j WHERE j.name = :name"),@NamedQuery(name = "JobEB.findByProfile", query = "SELECT j FROM JobEB j WHERE j.customerId.id = :pid")})
public class JobEB implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "numberOfPeople")
    private int numberOfPeople;
    @Basic(optional = false)
    @Lob
    @Column(name = "comment")
    private String comment;
    @Basic(optional = false)
    @Column(name = "name")
    private String name;
    @JoinColumn(name = "timeScheduleId", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private TimeScheduleEB timeScheduleId;
    @JoinColumn(name = "customerId", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private ProfilesEB customerId;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "jobId")
    private Collection<ProfileJobMapperEB> profileJobMapperEBCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "jobId")
    private Collection<TimeReportEB> timeReportEBCollection;

    public JobEB() {
    }

    public JobEB(Integer id) {
        this.id = id;
    }

    public JobEB(Integer id, int numberOfPeople, String comment, String name) {
        this.id = id;
        this.numberOfPeople = numberOfPeople;
        this.comment = comment;
        this.name = name;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public int getNumberOfPeople() {
        return numberOfPeople;
    }

    public void setNumberOfPeople(int numberOfPeople) {
        this.numberOfPeople = numberOfPeople;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public TimeScheduleEB getTimeScheduleId() {
        return timeScheduleId;
    }

    public void setTimeScheduleId(TimeScheduleEB timeScheduleId) {
        this.timeScheduleId = timeScheduleId;
    }

    public ProfilesEB getCustomerId() {
        return customerId;
    }

    public void setCustomerId(ProfilesEB customerId) {
        this.customerId = customerId;
    }

    public Collection<ProfileJobMapperEB> getProfileJobMapperEBCollection() {
        return profileJobMapperEBCollection;
    }

    public void setProfileJobMapperEBCollection(Collection<ProfileJobMapperEB> profileJobMapperEBCollection) {
        this.profileJobMapperEBCollection = profileJobMapperEBCollection;
    }

    public Collection<TimeReportEB> getTimeReportEBCollection() {
        return timeReportEBCollection;
    }

    public void setTimeReportEBCollection(Collection<TimeReportEB> timeReportEBCollection) {
        this.timeReportEBCollection = timeReportEBCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof JobEB)) {
            return false;
        }
        JobEB other = (JobEB) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "job.manager.db.ec.JobEB[id=" + id + "]";
    }

}
